package com.xy.xylive.api;

import com.github.pagehelper.PageInfo;
import com.xy.xylive.common.HttpStatus;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.List;

@Data
@AllArgsConstructor
public class PageR<T>
{
    private int code;
    private String msg;
    private List<T> rows;
    private long total;

    public static <T> PageR<T> ok(List<T> rows)
    {
        return new PageR<T>(HttpStatus.SUCCESS, "successs", rows, new PageInfo(rows).getTotal());
    }
}
